@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('heading')
    <h3>
        系统设置
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">系统设置</a>
        </li>
        <li class="active"> 广告设置</li>
    </ul>
@endsection

@section('wrapper')
    @include('share.error')
    <div class="row">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading">
                    &nbsp;
                    <span class="tools pull-right">
                            <button class="btn btn-info" onclick='location.href="{{ route('advertisement.create') }}"'
                                    type="button">新增</button>
                    </span>
                </header>
                <div class="panel-body">
                    <table class="table  table-hover general-table">
                        <thead>
                        <tr>
                            <th class="text-center">图片</th>
                            <th class="text-center">图片名称</th>
                            <th class="text-center">创建人</th>
                            <th class="text-center">上传云服务</th>
                            <th class="text-center">状态</th>
                            <th class="text-center">创建时间</th>
                            <th class="text-center">编辑时间</th>
                            <th class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($advertisements as $advertisement)
                            <tr>
                                <td class="text-center"><div style="width:105px;height: 80px;"><img src="{{ asset($advertisement->bannering->path) }}" style="height: 100%;" /></div></td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->bannering->name }}</td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->author->name }}</td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->is_upload == true ? '是' : '否' }}</td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->state == true ? '有效' : '禁用' }}</td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->created_at }}</td>
                                <td class="text-center" style="line-height:50px;">{{ $advertisement->updated_at }}</td>
                                <td class="text-center" style="line-height:50px;">
                                    <button class="btn btn-success btn-xs" type="button" onclick='location.href="{{ route('advertisement.edit', $advertisement->id) }}"'>编辑</button>
                                </td>
                            </tr>
                        @endforeach


                        </tbody>
                    </table>
                    <div>
                        <ul class="pagination pagination-lg">
                            {{ $advertisements->links() }}
                        </ul>
                    </div>
                </div>

            </section>
        </div>
    </div>
@endsection